﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HROReporting.Infrastructure.Authentication;
using HROReporting.Infrastructure.CookieStorage;
using HROReporting.Services.Interfaces;
using HROReporting.Services.ViewModels;
using System.Web.Mvc;
using HROReporting.Controllers.ViewModels.Locatie;
using HROReporting.Services.Messaging.SchoolLocatieService;

namespace HROReporting.Controllers.Controllers
{
    public class LocatieController : BaseController
    {
        private readonly ISchoolLocatieService _schoolLocatieService;

        public LocatieController(ICookieStorageService cookieStorageService,
                                 ISchoolLocatieService schoolLocatieService
                                )
            : base (cookieStorageService)
        {
            _schoolLocatieService = schoolLocatieService;
        }

        [Authorize]
        public ActionResult Index()
        {
            LocatieIndexView locatieIndexView = new LocatieIndexView();

            GetAllLocatiesResponse response = _schoolLocatieService.GetAllSchoolLocaties();

            locatieIndexView.SchoolLocaties = response.SchoolLocatieViews;

            return View(locatieIndexView);
        }
    }
}
